package com.ssyt.blog.core.sys.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.ssyt.blog.core.common.util.DateUtil;

@Entity
@Table(name = "blog", catalog = "blog")
public class Blog implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	private Integer id;
	private String name;
	private String description;
	@Column(name = "bg_image", nullable = false)
	private String bgImage;
	@Column(name = "create_time", nullable = false, length = 19)
	private Timestamp createTime;
	@Column(name = "user_id", nullable = false)
	private Integer userId;

	public Blog() {
	}

	public Blog(String name, String description, String bgImage,
			Timestamp createTime, Integer userId) {
		this.name = name;
		this.description = description;
		this.bgImage = bgImage;
		this.createTime = createTime;
		this.userId = userId;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getBgImage() {
		return this.bgImage;
	}

	public void setBgImage(String bgImage) {
		this.bgImage = bgImage;
	}

	public String getCreateTime() {

		return DateUtil.format(this.createTime, "yyyy/MM/dd HH:mm");
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@Override
	public String toString() {
		return "Blog [id=" + id + ", name=" + name + ", description="
				+ description + ", bgImage=" + bgImage + ", createTime="
				+ createTime + ", userId=" + userId + "]";
	}

}